package twitter 
{
	/**
	 * @author Nicolas Barradeau
	 * http://en.nicoptere.net
	 */
	public class TwitterEntry
	{
		private var _published:String;
		private var _updated:String;
		
		private var _twitUrl:String;
		private var _title:String;
		private var _content:String;
		private var _avatarUrl:String;
		
		private var _authorName:String;
		private var _authorURI:String;
		
		public function TwitterEntry( entry:XML = null )
		{
			if ( entry != null ) 
			{
				parseEntry( entry );
			}
		}
		
		public function parseEntry( entry:XML ):void
		{
			
			default xml namespace = Twitter.ns;
			
			published = entry.title.toString();
			updated = entry.updated.toString();
			
			title = entry.title.toString();
			content = entry.content.toString();
			
			for each( var link:XML in entry.descendants( 'link' ) )
			{	
				switch( link.@type ) 
				{
					case 'text/html':
					twitUrl = link.attribute( 'href' );
					break;
					
					case 'image/png':
					avatarUrl = link.attribute( 'href' );
					break;
				}
			}
			
			authorName = entry.author.name.toString();
			authorURI = entry.author.uri.toString();
			
		}
		
		public function get published():String { return _published; }
		
		public function set published(value:String):void 
		{
			_published = value;
		}
		
		public function get updated():String { return _updated; }
		
		public function set updated(value:String):void 
		{
			_updated = value;
		}
		
		public function get twitUrl():String { return _twitUrl; }
		
		public function set twitUrl(value:String):void 
		{
			_twitUrl = value;
		}
		
		public function get title():String { return _title; }
		
		public function set title(value:String):void 
		{
			_title = value;
		}
		
		public function get content():String { return _content; }
		
		public function set content(value:String):void 
		{
			_content = value;
		}
		
		public function get avatarUrl():String { return _avatarUrl; }
		
		public function set avatarUrl(value:String):void 
		{
			_avatarUrl = value;
		}
		
		public function get authorName():String { return _authorName; }
		
		public function set authorName(value:String):void 
		{
			_authorName = value;
		}
		
		public function get authorURI():String { return _authorURI; }
		
		public function set authorURI(value:String):void 
		{
			_authorURI = value;
		}
		
	}

}